
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<title>Heartbeat</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<div class="container-fluid">
  <script src="menu.js"></script>
  <div class="content p-3">
    <div class="container-fluid">
      <h2>Heartbeat</h2>
      <hr>
      <canvas id="heartbeat" width="200" height="100"></canvas>

      <h5 class="mt-3">Html</h5>
  <pre><code><!-- Defalut view dimension 200 x 100. Flexible view width. -->
<canvas id="heartbeat" width="200" height="100"></canvas></code></pre>

      <h5>JavaScript</h5>
<pre><code>/* Options */
var options = {
  // Scrolling speed. The higher, the faster.
  speed: 1,
  // Font and line color.
  fontColor: '#343a42',
  // The maximum number of beats can be displayed.
  maxQueueCapacity: 10
};

/* Constructor */
var heartbeat = new zeu.Heartbeat('heartbeat', options);

/* Function */
// Send a beat.
heartbeat.beat({
  // Beat color.
  color: '#28a748', 
  // Control the size of the beat. 0 is the largest beat. 40 is the smallest.
  space: 0
});</code></pre>

    <h4>More examples</h4>
    <p>
      Increase view width to 800 and capacity to 100 to see more beats and seconds. Beat every 0.2s in random color and size.
    </p>
    <canvas id="heartbeat-2" width="800" height="100"></canvas>
    </div>
  </div>
</div>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
<script src="docs.js"></script>
<script src="../dist/zeu.js"></script>
<script type="text/javascript">
/* Options */
var options = {
  speed: 1,
  fontColor: '#343a42',
  maxQueueCapacity: 30
};

/* Constructor */
var heartbeat = new zeu.Heartbeat('heartbeat', options);

var heartbeat2 = new zeu.Heartbeat('heartbeat-2', {
  viewWidth: 800,
  speed: 1,
  fontColor: '#343a42',
  maxQueueCapacity: 100
});

setInterval(function() {
  heartbeat.beat({
    color: '', 
    space: 0
    });
}, 1000);

setInterval(function() {
  heartbeat2.beat({
    color: getRandomColor(), 
    space: getRandomInt(0, 40)
    });
}, 200);

</script>
</body>
</html>

